package com.xzx.shop_front_api.controller.exam;

import com.xzx.shop_front_api.entity.exam.Article;
import com.xzx.shop_front_api.mapper.exam.ArticleMapper;
import com.xzx.shop_front_api.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("article")
public class ArticleController {
    @Autowired
    private ArticleMapper articleMapper;
    //根据id查询文章
    @GetMapping("details")
    public JsonResult article_details(@RequestParam("id") int id) {
        Article articleDetails = articleMapper.getArticleById(id);
        System.out.println(articleDetails);
        return JsonResult.success("ok",articleDetails);
    }

}
